package com.wzx.user.service.impl;

import com.wzx.user.dto.SearchDto;
import com.wzx.user.mapper.SearchMapper;
import com.wzx.user.service.SearchService;
import com.wzx.user.vo.SearchFriendVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wzx
 * @version 1.0
 * @date 2022/7/26 - 19:02
 * @description 标题
 */
@Service
public class SearchServcieImpl implements SearchService {

    @Autowired
    private SearchMapper searchMapper;

    @Override
    public List<SearchDto> searchByCondition(Integer userId,String searchName) {
        return searchMapper.searchByCondition(userId,searchName);
    }

    @Override
    public List<SearchDto> searchByFriend(SearchFriendVo searchFriendVo) {
        if(searchFriendVo.getSearchType().equals(1)){
            return searchMapper.searchByFriend(searchFriendVo);
        }else {
            return searchMapper.searchByGroup(searchFriendVo);
        }
    }

}
